package cn.txun05.csmall.passport.service.impl;

import cn.txun05.csmall.commons.ex.ServiceException;
import cn.txun05.csmall.passport.mapper.RoleMapper;
import cn.txun05.csmall.passport.pojo.vo.RoleListItemVO;
import cn.txun05.csmall.passport.service.IRoleService;
import cn.txun05.csmall.commons.web.ServiceCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class RoleServiceImpl implements IRoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Override
    public List<RoleListItemVO> list() {
        log.debug("开始处理[查询角色列表]的业务,无参数");
        List<RoleListItemVO> list = roleMapper.list();
        if(list==null || list.size()==0){
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND,"无角色信息，请联系管理员！");
        }
        return list;
    }
}
